/*
 * EventLoopThread.h
 *
 *  Created on: 2021年4月6日
 *      Author: san
 */

#ifndef EVENTLOOPTHREAD_H_
#define EVENTLOOPTHREAD_H_

#include "EventLoop.h"
#include "base/Condition.h"
#include "base/Mutex.h"
#include "base/Thread.h"
#include "base/noncopyable.h"

namespace san {

class EventLoopThread {
public:
	EventLoopThread();
	~EventLoopThread();

	EventLoop *startLoop();

private:
	void threadFunc();
	EventLoop *loop_;
	bool exiting_;
	Thread thread_;
	MutexLock mutex_;
	Condition cond_;
};

} /* namespace san */

#endif /* EVENTLOOPTHREAD_H_ */
